<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - Conversion to Json schema example</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

<body class="yui-skin-sam">
	
	<h1>inputEx - Convert inputEx definition to json schema</h1>
	

<!-- Example 1 -->
<div class='exampleDiv'>
	<h2>Convert inputEx definition to json schema</h2>
	<p></p>
	<div class='demoContainer' id='container1'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			// Convert the community json-schema to inputEx json
			var builder = new inputEx.JsonSchema.Builder({
				'schemaIdentifierMap':base_schema_map,
			  	'defaultOptions':{
			     	'showMsg':true
			  	}
		  	});
			var inputExJson = builder.schemaToInputEx(base_schema_map["community"]);

			// Convert it back to json-schema using inputExToSchema
			var communitySchema = inputEx.JsonSchema.inputExToSchema(inputExJson);
			//console.log(inputExJson);
			//console.log( communitySchema );

			// Converting it a last time to inputEx and build the form
			var builder2 = new inputEx.JsonSchema.Builder({
				'schemaIdentifierMap': {
					"community": communitySchema
				},
			  'defaultOptions':{
			     'showMsg':true
			  }
		  });
			var m = builder2.schemaToInputEx(communitySchema);
			m.parentEl = 'container1';
			var f = inputEx(m);
		</textarea>
	</div>
</div>
	
<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="../lib/yui/menu/menu-min.js"></script>
<script type="text/javascript" src="../lib/yui/button/button-min.js"></script>
<script type="text/javascript" src="../lib/yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="../lib/yui/autocomplete/autocomplete-min.js"></script>
<script type="text/javascript" src="../lib/yui/editor/editor-min.js"></script>


<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/mixins/choice.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/Group.js"></script>
<script src="../js/fields/CheckBox.js"></script>
<script src="../js/fields/StringField.js"></script>
<script src="../js/fields/ListField.js"></script>
<script src="../js/fields/Textarea.js"></script>
<script src="../js/fields/EmailField.js"></script>
<script src="../js/fields/UrlField.js"></script>
<script src="../js/fields/ColorField.js"></script>
<script src="../js/fields/DateField.js"></script>
<script src="../js/fields/SelectField.js"></script>
<script src="../js/fields/RTEField.js"  type='text/javascript'></script>
<script src="../js/json-schema.js"></script>

<!-- json schema to load -->
<script src="base-schema.js"></script>

<!-- inputEx examples -->
<script src="js/dpSyntaxHighlighter.js"></script>
<script src="inputex-examples.js"></script>


 </body>
</html>